package errx

import "github.com/pkg/errors"

var ErrMap = map[CtpErrCode]error{
	//SysError: errors.New("System error, Couldn't recover"),
	//DefError: errors.New("Default error, Unknown"),
	//ApiError: errors.New("Something wrong with API"),
	RpcError: errors.New("Something wrong with RPC"),

	DecError: errors.New("Calculation not allowed"),

	TmpError: errors.New("It's a temporary error, Waiting to be resolved"),
}

type CtpErrCode int

const (
	RpcError CtpErrCode = 2003

	DecError CtpErrCode = 2011

	TmpError CtpErrCode = 2099
)

func CtpError(errCode CtpErrCode) error {
	err, ok := ErrMap[errCode]
	if ok {
		return err
	}
	return ErrMap[TmpError]
}
